﻿using OSS.BIM.Model;
using OSS.BIM.Utility;
// ***********************************************************************
// Assembly         : OSS.BIM
// Author           : tianteng
// Created          : 04-23-2018
//
// Last Modified By : tianteng
// Last Modified On : 04-23-2018
// ***********************************************************************
// <copyright file="GroupModelShowCmd.cs" company="北京智帆高科科技有限公司">
//     Copyright ©  2017
// </copyright>
// <summary></summary>
// ***********************************************************************
using ZFGK.Addins;
using ZFGK.osgEarth.UI;

namespace OSS.BIM.Commands.GroupModelCmds
{
    /// <summary>
    /// Class GroupModelShowCmd.
    /// </summary>
    /// <seealso cref="ZFGK.Addins.IExtendCommand" />
    public class GroupModelShowCmd : IExtendCommand
    {
        /// <summary>
        /// Executes the specified command data.
        /// </summary>
        /// <param name="cmdData">The command data.</param>
        /// <param name="message">The message.</param>
        /// <returns>CmdResult.</returns>
        public CmdResult Execute(ExtendCmdData cmdData, ref string message)
        {
//             if (!PermissionApp.CurUser.CheckUser())
//             {
//                 return CmdResult.Cancel;
            //             }
            var form = cmdData.ViewForm as OsgEarthViewForm;
            var osgEarthViewCtrl = form.OsgEarthViewCtrl;

            ModelElement userModel = cmdData.Tag as ModelElement;
            if (userModel == null)
            {
                return CmdResult.Cancel;
            }
            osgEarthViewCtrl.OsgEarthObj.AddOrReplaceModel(userModel);
            return CmdResult.Succeed;
        }
    }
}
